﻿namespace MaterialTypeRecognition.Shell.Controllers
{
    using Microsoft.AspNetCore.Mvc;

    [Route("api/[controller]")]
    [ApiController]
    public class SampleController : ControllerBase
    {
        // GET: api/sample
        [HttpGet]
        public IActionResult Get()
        {
            return Ok("GET request");
        }

        // GET: api/sample/{id}
        [HttpGet("{id}")]
        public IActionResult GetById(int id)
        {
            return Ok($"GET request for id: {id}");
        }

        // POST: api/sample
        [HttpPost]
        public IActionResult Post([FromBody] SampleModel model)
        {
            // 处理传入的模型数据
            return Ok("POST request");
        }

        // PUT: api/sample/{id}
        [HttpPut("{id}")]
        public IActionResult Put(int id, [FromBody] SampleModel model)
        {
            // 根据 id 和传入的模型数据更新资源
            return Ok($"PUT request for id: {id}");
        }

        // DELETE: api/sample/{id}
        [HttpDelete("{id}")]
        public IActionResult Delete(int id)
        {
            // 根据 id 删除资源
            return Ok($"DELETE request for id: {id}");
        }
    }

}
